package com.plian.system.wrapper.dsh;

import com.plian.system.dto.dsh.DshStaffManagementDTO;
import com.plian.system.dto.hr.staff.SupervisorDTO;
import com.plian.system.entity.dsh.DshStaffManagement;
import com.plian.system.entity.hr.staff.Supervisor;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.dsh.DshStaffManagementVO;
import com.plian.system.vo.hr.staff.SupervisorVO;
import com.plian.system.vo.zzd.sys.PersonnelSimpleInfoVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 近五年三个月以上培训情况包装类,返回视图层所需的字段
 *
 * @author gangan
 * @since 2019-11-12
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface DshStaffManagementWrapper extends BaseWrapper<DshStaffManagement, DshStaffManagementDTO, DshStaffManagementVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "companyId", target = "companyName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "companyId", target = "companyCode", qualifiedByName = ORG_ID_TO_CODE),
			@Mapping(source = "genderId", target = "genderName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "isOutSupervisor", target = "isOutSupervisorName", qualifiedByName = IS_OR_NO),
			@Mapping(source = "supervisorPositionId", target = "supervisorPositionName", qualifiedByName = DICT_CODE_TO_NAME)
	})
	DshStaffManagementVO entityToVO(DshStaffManagement entity);

	@Mappings(value = {
			@Mapping(source = "supervisorPositionId", target = "jobName", qualifiedByName = DICT_CODE_TO_NAME)
	})
	PersonnelSimpleInfoVO entityToPersonnelSimpleInfoVO(DshStaffManagement entity);

	List<PersonnelSimpleInfoVO> entityToPersonnelSimpleInfoVO(List<DshStaffManagement> entityList);
}
